package test;

import com.qf.bean.Teacher;
import com.qf.service.TeacherService;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.Date;
import java.util.List;

/**
 * 2019/11/30
 * Administrator
 * springdata1130
 * 面向对象面向君  不负代码不负卿
 */
public class Demo2 {
    public static void main(String[] args) {
        ClassPathXmlApplicationContext applicationContext =
                new ClassPathXmlApplicationContext("springData.xml");
       TeacherService teacherService=(TeacherService) applicationContext.getBean("teacherServiceImpl");
      //  Teacher teacher = teacherService.insertTea(new Teacher("lisi", "男", new Date()));
      //  System.out.println(teacher);
   /*     Teacher teacher = new Teacher("zhangsan123", "男", new Date());
        teacher.setTid(1);
        Teacher teacher1 = teacherService.updateTeacher(teacher);
        System.out.println(teacher1);
        System.out.println("主键查询:");
        Teacher teacher2 = teacherService.findbyid(1);
        System.out.println(teacher2);*/
        //List<Teacher> teachers = teacherService.findbyname("%z%");
        List<Teacher> teachers = teacherService.findbytnameAndsex("zhangsan123", null);
        for (Teacher teacher : teachers) {
            System.out.println(teacher);
        }
    }
}
